#ifndef VD_PNP
#define VD_PNP

# include "vd.h"

NTSTATUS VD_PnP(IN PDEVICE_OBJECT DeviceObject,
		  IN PIRP Irp)
{

	PDEVICE_EXTENSION		device_extension;
	PIO_STACK_LOCATION		io_stack;
	NTSTATUS				status;

	device_extension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

	io_stack = IoGetCurrentIrpStackLocation(Irp);

	switch (io_stack->MinorFunction)
    {
		case IRP_MN_QUERY_DEVICE_RELATIONS:
		{
			NTSTATUS status = Irp->IoStatus.Status; 
			DbgPrint("IRP_MN_QUERY_DEVICE_RELATIONS \n");
			break;
		}
    default:
      DbgPrint("Unknown PnP function (%#x)\n",io_stack->MinorFunction);

      status = STATUS_INVALID_DEVICE_REQUEST;
      Irp->IoStatus.Information = 0;
    }

	if (status == STATUS_PENDING)
    {
		IoMarkIrpPending(Irp);

		ExInterlockedInsertTailList(
									&device_extension->list_head,
									&Irp->Tail.Overlay.ListEntry,
									&device_extension->list_lock);

      KeSetEvent(
				&device_extension->request_event,
				(KPRIORITY) 0, 
				FALSE
				);
    }
	
	else
    {
		Irp->IoStatus.Status = status;
		IoCompleteRequest(Irp, IO_NO_INCREMENT);
    }

	return status;
}

# endif